package yl.hs.bmipfull.controllers.material;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.service.material.IPurchaseSystemLogService;
import yl.hs.bmipfull.viewmodels.PageQuery;
import yl.hs.bmipfull.viewmodels.WebResult;

/**
 * 作用:   <br/>
 * 创建时间: 2021-07-07 14:47 <br/>
 *
 * @author 吴高丰
 */
@Api(value = "采购管理日志操作", tags = "采购管理——采购管理日志操作")
@RequestMapping(value = "/api/purchaseSystemLog")
@RestController
public class PurchaseSystemLogController extends ControllerBase {
    @Autowired
    IPurchaseSystemLogService service;

    @ApiOperation(value = "查询采购管理日志", notes = "查询采购管理日志")
    @RequestMapping(value = "/{dataSN}", method = RequestMethod.GET)
    public WebResult queryList(@ApiParam(value = "数据编号") @PathVariable String dataSN) {
        try {
            return success("查询成功", service.queryLsitByDataSn(dataSN));
        } catch (Exception e) {
            return error(e);
        }
    }
    @ApiOperation(value = "查询销售操作日志", notes = "根据销售操作日志编号查询销售操作日志")
    @RequestMapping(value = "/{rowNum}/{page}", method = RequestMethod.POST)
    public WebResult queryLogBy(@RequestBody PageQuery query,
                                @ApiParam(value = "页码") @PathVariable int page,
                                @ApiParam(value = "每页条数") @PathVariable int rowNum) {
        var data = service.queryCP(query, rowNum, page);
        return success("查询成功",data);

    }
}
